home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Images and Bitmaps / PartialImageRotate / PartialImageRotate.cs next >
Encoding:
Text File  |  2001-01-15  |  967 b   |  33 lines

  1. //-------------------------------------------------
  2. // PartialImageRotate.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class PartialImageRotate: PrintableForm
  9. {
  10.      Image image;
  11.  
  12.      public new static void Main()
  13.      {
  14.           Application.Run(new PartialImageRotate());
  15.      }
  16.      public PartialImageRotate()
  17.      {
  18.           Text = "Partial Image Rotate";
  19.  
  20.           image = Image.FromFile("..\\..\\..\\Apollo11FullColor.jpg");
  21.      }
  22.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  23.      {
  24.           Point[] aptDst = { new Point(0, cy / 2),
  25.                              new Point(cx / 2, 0),
  26.                              new Point(cx / 2, cy) };
  27.  
  28.           Rectangle rectSrc = new Rectangle(95, 5, 50, 55);
  29.           
  30.           grfx.DrawImage(image, aptDst, rectSrc, GraphicsUnit.Pixel);
  31.      }
  32. }
  33.